from django.urls import path, re_path
from rest_framework import routers

from system.menu.views.menu import MenuViewSet
from system.menu.views.menu_button import MenuButtonViewSet

system_url = routers.SimpleRouter()
system_url.register(r'', MenuViewSet)

menu_list = MenuViewSet.as_view({
    'get': 'menu_list',
})

button = MenuButtonViewSet.as_view({
    'post': 'create',
    'put': 'update'
})

urlpatterns = [
    path('menu_list/', menu_list),
    re_path('button/$', button),
    re_path('button/(?P<pk>[^/.]+)/$', button),
]
urlpatterns += system_url.urls
